#pragma once
#include <iostream>
#include <unistd.h>
#include <string>
using namespace std;
class Task
{
public:
    Task()
    {
    }
    Task(int x, int y, char way)
        : _y(y),
          _x(x),
          _way(way)
    {
    }
    void operator()()
    {
        switch (_way)
        {
        case '+':
            _result = _x + _y;
            break;
        case '-':
            _result = _x - _y;
            break;
        case '*':
            _result = _x * _y;
            break;
        case '/':
            if (_y == 0)
            {
                _exitnode = -1;
            }
            else
            {
                _result = _x / _y;
            }
            break;
        case '%':
            if (_y == 0)
            {
                _exitnode = -1;
            }
            else
            {
                _result = _x % _y;
            }
            break;
        default:
            _exitnode = -1;
            break;
        }
    }

    string to_productor()
    {
        return to_string(_x)+_way+to_string(_y)+"=?";
    }
    string to_customer()
    {
        return to_string(_x)+_way+to_string(_y)+"="+to_string(_result)+'('+to_string(_exitnode)+')';
    }
private:
    int _x;
    int _y;
    char _way;
    int _result = 0;
    int _exitnode = 0;
};
